/**
 * 
 */
package com.roa.generics.connection;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.naming.NamingException;

/**
 * @author jlrojas
 *
 */
public class DBStatement {

	public static ResultSet executeSimpleQuery(String sql) throws SQLException, NamingException{
		ResultSet rs = null;
		try{
			Statement st = DBConnection.connect().getConnection().createStatement();
			rs = st.executeQuery(sql);
		}catch(SQLException e){
			throw e;
		}
		return rs;
	}
	
	public static int ejecutarSqlModificacion(String sql) throws SQLException, NamingException{
		int count = 0;
		try{
			Statement st = DBConnection.connect().getConnection().createStatement();
			count = st.executeUpdate(sql);
		}catch(SQLException e){
			throw e;
		}
		return count;
	}
	
}
